Function.prototype.myBind = function (ctx, ...args) {
    const fn = this;
    return function (...args2) {
        if(new.target) {
            return new fn(...args, ...args2);
        }
        return fn.apply(ctx, [...args, ...args2]);
    }
}

function fn (a,b,c,d) {
    console.log(a,b,c,d)
    console.log(this);
}

const fn1 = fn.bind(1,2,3);
fn1(4,5);

const r = new fn1(4,5)
console.log(r)